<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Jugando OBingo!</title>
<link rel="stylesheet" type="text/css" href="style/main.css" />
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js" type="text/javascript" charset="utf-8"></script>
    <SCRIPT SRC="func.js">
    </SCRIPT>
    <SCRIPT>
var TotalBoardNum = 75;//cannot be changed for this script
var ultValor = 0;
var CardCols = 5;//number of cols/rows for PLAYER's card
var InPlay = new Array();//contains already opened numbers
var Winner = new Array();
</SCRIPT>
    <script type="text/javascript" charset="utf-8">

	function clickCasilla(elemento){

			elemento.style.backgroundColor= (elemento.style.backgroundColor=="green" ? "transparent":"green");
			variable = document.getElementById("s"+elemento.id);
			variable.value=(variable.value=="n" ? "s":"n");

	}

    $(document).ready(function(){
		inicioPartida(document.getElementById('partida').value,document.getElementById('ronda').value);
        //waitForMsg(document.getElementById('partida').value,document.getElementById('ronda').value); /* Start the inital request */

    });
</script>
</head>

<body>

   <!-- Begin Wrapper -->
   <div id="wrapper">

         <!-- Begin Header -->
         <div id="header">

		       <a href="index.php"><img class="logo" src="img/logo Obingo.png" /></a>

		 </div>
		 <!-- End Header -->

		 <!-- Begin Content -->
		 <div id="content">
		 		<div id="cartona">
    <?php
	include "conectarse.php";
	$idUsuario = $_GET['id'];
	$idRonda = 0;$idPartida =0;
	$resultado = mysql_query("SELECT * FROM usuario_conectado WHERE idUsuario_Conectado = ".$idUsuario, $link);
	while ($registro = mysql_fetch_array($resultado)){
			$idRonda = $registro['Ronda_idRonda'];
			$idPartida = $registro['Ronda_Partida_idPartida'];
	}
	echo '<input type="text" disabled="disabled" name="cantado" id="cantado" value="" class = "cantado" />';
	echo '<input type="hidden" name="ronda" id="ronda" value="'.$idRonda.'">';
	echo '<input type="hidden" name="partida" id="partida" value="'.$idPartida.'">';
	$resultado = mysql_query("SELECT * FROM carton WHERE id_Carton IN (SELECT idCarton FROM usuario_carton WHERE idUsuario =".$idUsuario.")", $link);
	$i=1;
	while ($registro = mysql_fetch_array($resultado)){
			//echo "<div style='background-image: url(cartonp.png); height: 203px; width: 170px; border: 1px solid black;'></div>";
			$res = mysql_query("SELECT status FROM usuario_carton WHERE idCarton =".$registro['id_Carton'], $link);
			$dis = "";
			while ($reg = mysql_fetch_array($res)){
				if ($reg['status'] == 1){
					$dis = 'disabled="disabled"';
					}
				}
			echo '<FORM ACTION="validarGanador.php" method="POST" id="f'.$i.'">';
			echo '<input type="hidden" name="nc" id="nc'.$i.'" value="'.$i.'">';
			echo '<input type="hidden" name="ro'.$i.'" id="ro'.$i.'" value="'.$idRonda.'">';
			echo '<input type="hidden" name="id'.$i.'" id="id'.$i.'" value="'.$registro['id_Carton'].'">';
			echo "<div class='cartonBingo'><TABLE class = 'sample'>";
			for ($j=1; $j<6; $j++) {
				echo "<TR>";
				for ($k=1; $k<6; $k++) {
					echo '<TD height=20 width=40 align="center" id="C'.($i).($j).($k).'" onclick="clickCasilla(this)">'.$registro['num'.$j.$k].'</TD><input type="hidden" name="sC'.($i).($j).($k).'" id="sC'.($i).($j).($k).'" value="n" />';
					}
					echo "</TR>";
				}
				echo "</TABLE>";
				$name = "f".$i;
				echo '<input type="button" value="BINGO!" id="b'.$name.'" onclick="validarBingo(\''.$name.'\')" '.$dis.'/>';
				$i++;
				echo '</FORM>';
                                echo "</div>";
				
		}
		include "desconectarse.php";
	?>
    </div>
		 </div>
		 <!-- End Content -->

		 <!-- Begin Footer -->
		 <div id="footer">
			    Realizado por Gabriel Afonso, Adri&aacute;n Matteo y Bruno Terra.
	     </div>
		 <!-- End Footer -->

   </div>
   <!-- End Wrapper -->

</body>
</html>




